<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      xmlns:th="http://www.thymeleaf.org"
      layout:decorator="backstage/layout">
<head>
    <title>学校管理</title>
</head>

<body>
<div id="content" layout:fragment="content">
<script type="text/javascript" src="../../admin/js/bootstrap-paginator.js"></script>
<script type="text/javascript" src="../../admin/ace/js/fuelux/fuelux.spinner.min.js"></script>
<script type="text/javascript" src="../../admin/ace/js/ace-elements.min.js"></script>
<script type="text/javascript" src="../../../admin/js/schoolList.js"></script>
    <div class="box-content">
        <div class="row-fluid sortable">
            <div class="box span12">
                <h3 class="row-fluid header smaller lighter blue">
                   <span class="label label-large label-pink arrowed-right">学校管理</span>
                </h3>
                <h3 class="row-fluid header smaller lighter blue">
                    <a href="#" class="btn btn-small btn-success btn-setting" data-toggle="modal" data-target="#myModal"><i class="icon-user"></i>添加学校</a>
                </h3>
                
                 <form action="/school/schoolList.htm" method="post" id="searchForm">
			        <input type="hidden"  id="page" name="page" th:value="${page.page}" />
		            <input type="hidden"  name="totalPage" th:value="${page.totalPage}" />
		            <input type="hidden" id="name" th:value="${page.filter[name]}" />
		            
		            <span class="topword">学校名称：</span>
		                <input type="text" class="input-xlarge focused" name="name" th:value="${page.filter[name]}"/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		            <span class="topword">所属分区：</span>
		            			<select name="zoneId" >
		            			    <option value=" ">请选择</option>
		            				<option th:each="zone:${zoneList}" th:selected="${zone.id == school.zoneId}" th:value="${zone.id}" th:text="${zone.name}"></option>
		            			</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		            <input type="submit" class="btn btn-info btn-inverse" value="搜索"/>				
			           
                 </form>
                <div class="box-content">
                    <table class="table table-striped table-bordered bootstrap-datatable datatable">
                        <thead>
                        <tr>
                            <th style="text-align: center;">序号</th>
                            <th style="text-align: center;">学校名称</th>
                            <th style="text-align: center;">所属分区</th>
                            <th style="text-align: center;">所属城市</th>
                            <th style="text-align: center;">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="school:${page.result}">
                            <td th:text="${school.id}" style="text-align: center;"></td>
                            <td th:text="${school.name}" style="text-align: center;"></td>
                            <td th:text="${school.zoneName}" style="text-align: center;"></td>
                            <td th:text="${school.cityName}" style="text-align: center;"></td>
                            <td style="text-align: center;">
                                <a class="btn btn-small btn-danger" th:id="${school.id}" style="width: 26px;">
                                                                                                             删除 
                                </a>
                                 <a class="btn btn-info btn-small editSchoolBT" th:id="${school.id}" style="width: 26px;">
                                                                                                           编辑 
                                </a>
                              <input type="hidden" th:id="'schoolName-'+${school.id}" th:value="${school.name}"/>
                               
                              <input type="hidden" th:id="'zoneId-'+${school.id}" th:value="${school.zoneId}"/>
                              <input type="hidden" th:id="'cityId-'+${school.id}" th:value="${school.cityId}"/>
                              
                              <input type="hidden" th:id="'slogan-'+${school.id}" th:value="${school.slogan}"/>
                              <input type="hidden" th:id="'description-'+${school.id}" th:value="${school.description}"/>
                              <input type="hidden" th:id="'logUrl-'+${school.id}" th:value="${school.logoUrl}"/>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    
                     <div style="margin-bottom: 0px; margin-left: auto;margin-right: auto">
                        <div id="example" style="margin-bottom:0px"></div>
                     </div>
                </div>
            </div><!--/span-->
        </div><!--/row-->
    </div>
    <div id="myModal" class="modal hide fade in">
        <div class="modal-header">
            <button class="close" data-dismiss="modal" type="button">×</button>
            <h3>添加学校</h3>
        </div>
        <form class="form-horizontal" style="margin: 0" enctype="multipart/form-data" action="/school/addSchool.json" method="post" id="addSchool">
            <fieldset>
                <div class="modal-body">
                    <div class="control-group">
                        <label class="control-label">学校名称：</label>
                        <div class="controls">
                            <input class="input-xlarge focused"  type="text" value="" name="name" />
                        </div>
                    </div>
                    
                     <div class="control-group">
                      <label class="control-label">所属分区：</label>
                      <div class="controls">
                          <select  id="zoneSel" name="zoneId" >
                              
                              <option th:each="zone:${zoneList}"  th:value="${zone.id}" th:text="${zone.name}"></option>
                          </select>
                      </div>
                     </div>
                
	                <div class="control-group">
	                      <label class="control-label">所属城市：</label>
	                      <div class="controls">
	                          <select  id="citySel" name="cityId" >
	                              
	                              <option th:each="city:${cityList}"  th:value="${city.id}" th:text="${city.name}"></option>
	                          </select>
	                      </div>
	                </div>
	                
	                <div class="control-group">
                        <label class="control-label">口号：</label>
                        <div class="controls">
                           <textarea  name="slogan"></textarea>
                        </div>
                   </div>
                   
                   <div class="control-group">
                        <label class="control-label">学校描述：</label>
                        <div class="controls">
                           <textarea  name="description"></textarea>
                        </div>
                   </div>
                   
                   <div class="control-group">
                        <label class="control-label">学校LOG：</label>
                        <div class="controls">
                            <div class="widget-main" style="padding:0px;">
	                        	<input type="file" id="id-input-file-1" name="file" />
		                    </div>
                        </div>
                   </div>
                </div>
                
               
                <div class="modal-footer">
                    <input type="submit" class="btn btn-primary" value="保存" />
                    <a href="#" class="btn btn-small" data-dismiss="modal">取消</a>
                </div>
            </fieldset>
        </form>
    </div>
    
    
    <div id="editModel" class="modal hide fade in" style="display: none;">
        <div class="modal-header">
            <button class="close" data-dismiss="modal" type="button">×</button>
            <h3>编辑分区</h3>
        </div>
        <form class="form-horizontal" style="margin: 0" enctype="multipart/form-data" action="/school/updateSchool.json" method="post" id="updateSchool">
             <input id="edit-id" name="id" type="hidden"/>
            <fieldset>
                <div class="modal-body">
                    <div class="control-group">
                        <label class="control-label">名称：</label>
                        <div class="controls">
                            <input class="input-xlarge focused"  type="text" value="" name="name" id="schoolName"/>
                        </div>
                    </div>
                    
                    <div class="control-group">
                      <label class="control-label">所属分区：</label>
                      <div class="controls">
                          <select  id="zoneSel2" name="zoneId" >
                              <option th:each="zone:${zoneList}" th:value="${zone.id}" th:text="${zone.name}"></option>
                          </select>
                      </div>
                    </div>
                  
	                  <div class="control-group">
	                      <label class="control-label">所属城市：</label>
	                      <div class="controls">
	                          <select  id="citySel2" name="cityId" >
	                              <option th:each="city:${cityList}"  th:value="${city.id}" th:text="${city.name}"></option>
	                          </select>
	                      </div>
	                  </div>
	                  
	                  <div class="control-group">
                        <label class="control-label">口号：</label>
                        <div class="controls">
                           <textarea  name="slogan" id="edit-slogan"></textarea>
                        </div>
                     </div>
                   
	                   <div class="control-group">
	                        <label class="control-label">学校描述：</label>
	                        <div class="controls">
	                           <textarea  name="description" id="edit-description"></textarea>
	                        </div>
	                   </div>
	                   
	                   <div class="control-group">
	                        <label class="control-label">学校LOG：</label>
	                        <div class="controls">
	                            <div class="widget-main">
		                        	<input type="file" id="id-input-file-2" name="file" />
			                    </div>
	                        </div>
	                        <div class="controls">
	                            <div class="widget-main">
	                                <img src="" id="edit_imgShow" style="height: 120px"/>
	                            </div>
	                        </div>
                        
                       </div>
                   
                </div>
                <div class="modal-footer">
                    <input type="submit" class="btn btn-primary" value="保存" />
                    <a href="#" class="btn btn-small" data-dismiss="modal">取消</a>
                </div>
            </fieldset>
        </form>
    </div>
</div>
</body>
</html>
